from redis.client import Redis

mconn = Redis(host="192.168.35.110", port=6379, db=0, decode_responses=True)


def print_hi(name):
    # 在下面的代码行中使用断点来调试脚本。
    print(f'Hi, {name}')  # 按 Ctrl+F8 切换断点。


# 按间距中的绿色按钮以运行脚本。
if __name__ == '__main__':
    print(mconn.config_get('set-max-intset-entries'))
    print(mconn.config_get('list-max-listpack-size'))
    print(mconn.config_get('hash-max-listpack-entries'))
    print(mconn.config_get('hash-max-listpack-value'))
    print(mconn.config_get('zset-max-listpack-entries'))
    print(mconn.config_get('zset-max-listpack-value'))
    mconn.delete('test:myset')
    mconn.sadd('test:myset', *range(500))
    print(mconn.debug_object('test:myset'))
    mconn.sadd('test:myset', *range(513))
    print(mconn.debug_object('test:myset'))
    mconn.delete('test:myhash')
    mconn.hset('test:myhash', 'id', 1)
    print(mconn.debug_object('test:myhash'))
    mconn.hset('test:myhash', 'id2', 513 * 'asd')
    print(mconn.debug_object('test:myhash'))
    mconn.delete('test:myzset')
    mconn.zadd('test:myzset', {'id': 1})
    print(mconn.debug_object('test:myzset'))
    mconn.zadd('test:myzset', {513 * 'asd': 1})
    print(mconn.debug_object('test:myzset'))

    mconn.delete('test:mylist')
    mconn.lpush('test:mylist', '1')
    print(mconn.debug_object('test:mylist'))
    mconn.lpush('test:mylist', 513 * 'asd')
    print(mconn.debug_object('test:mylist'))

# 访问 https://www.jetbrains.com/help/pycharm/ 获取 PyCharm 帮助
